package com.example.administrator.gplineview;

/**
 * Created by chenj
 * Created on 2017/4/21
 */

public class EmailVallidator {
    public boolean test(String emailAddr) {
        if (!emailAddr.contains("@")){
            return false;
        }else if (emailAddr.startsWith("@")){
            return false;
        }else if (emailAddr.endsWith("@")){
            return false;
        }else{
            String[] split = emailAddr.split("@");
            if (split.length != 2){
                return false;
            }else if (!split[1].contains(".")){
                return false;
            }else if (split[1].startsWith(".")){
                return false;
            }else if (split[1].endsWith(".")){
                return false;
            }else{
                return true;
            }
        }
    }
}
